Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed issues related to DBEncryption in RSDBPersistentManager and enhanced error handling #403

Merged
merged 11 commits into from
Oct 9, 2023

Conversation

desusai7
Copy link
Contributor

@desusai7 desusai7 commented Oct 3, 2023

Description

  • Added a check to see if SQLCipher is available during run time when the DBEncryption feature is enabled, if not then the SDK will log an error message to the developer to ensure that the SQLCipher is linked well to the project.
  • Refactored createDB method of RSDBPersistentManager to reduce its cognitive complexity by breaking down the method into multiple methods.
  • Fixed the below issues in the of RSDBPersistentManager:
    • When an unencrypted database exists already in the app and the developer enables the encryption on the next run with a key. SDK will encrypt the unencrypted database and from then it will start saving events to the new encrypted database. But however, if SDK failed to encrypt the unencrypted database after opening it, SDK would keep writing events to the unencrypted database despite the developer enabling the encryption.
    • When an encrypted database exists already in the app and the developer disables the encryption on the next run with the valid key, then SDK will decrypt the encrypted database and from then it will start saving events to the new unencrypted database. But however, if SDK failed to decrypt the encrypted database after opening it, SDK would keep writing events to the encrypted database despite the developer disabling the encryption.
    • When an encrypted database exists already in the app and the developer disables the encryption on the next run with the valid key, then SDK will decrypt the encrypted database and from then it will start saving events to the new unencrypted database. But however, if SDK failed to open the encrypted database before trying to decrypt it for any reason, SDK would keep writing events to the encrypted database despite the developer disabling the encryption.

@desusai7 desusai7 self-assigned this Oct 3, 2023
Sources/Classes/RSDBPersistentManager.m Outdated Show resolved Hide resolved
Sources/Classes/RSDBPersistentManager.m Outdated Show resolved Hide resolved
Sources/Classes/RSDBPersistentManager.m Show resolved Hide resolved
Sources/Classes/RSDBPersistentManager.m Outdated Show resolved Hide resolved
Desu Sai Venkat added 2 commits October 3, 2023 18:49
@desusai7 desusai7 requested a review from pallabmaiti October 4, 2023 06:13
pallabmaiti
pallabmaiti previously approved these changes Oct 4, 2023
1abhishekpandey
1abhishekpandey previously approved these changes Oct 4, 2023
pallabmaiti
pallabmaiti previously approved these changes Oct 4, 2023
@desusai7 desusai7 dismissed stale reviews from pallabmaiti and 1abhishekpandey via 6f99ad8 October 5, 2023 07:14
pallabmaiti
pallabmaiti previously approved these changes Oct 6, 2023
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

19.1% 19.1% Coverage
0.0% 0.0% Duplication

@desusai7 desusai7 merged commit 2e9c2cf into develop Oct 9, 2023
@1abhishekpandey 1abhishekpandey deleted the enhance/dbencryption branch January 4, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants